}
this._getMenuItems()[position].actor.visible = visible;
+ },
+
+ getItemVisible: function(position) {
+ return this._getMenuItems()[position].actor.visible;
}
};
if (params.style_class)
this._menu.actor.add_style_class_name(params.style_class);
+ this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
+
this._activeItemPos = -1;
this._items = [];
},
return null;
},
+ _onScrollEvent: function(actor, event) {
+ if (this._activeItemPos == -1)
+ return;
+
+ let position = this._activeItemPos;
+ let direction = event.get_scroll_direction();
+ if (direction == Clutter.ScrollDirection.DOWN) {
+ while (position < this._items.length - 1) {
+ position++;
+ if (this._menu.getItemVisible(position))
+ break;
+ }
+ } else if (direction == Clutter.ScrollDirection.UP) {
+ while (position > 0) {
+ position--;
+ if (this._menu.getItemVisible(position))
+ break;
+ }
+ }
+
+ if (position == this._activeItemPos)
+ return;
+
+ this.setActiveItem(position);
+ this.emit('active-item-changed', position);
+ },
+
activate: function(event) {
let topMenu = this._getTopMenu();
if (!topMenu)